package com.tinghua.mqTest.utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class ConnectionMQ {
    /**
     * 创建信道工具类
     * @return
     * @throws IOException
     * @throws TimeoutException
     */
    public static Channel utilConnectionMQ() throws IOException, TimeoutException{
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("81.71.1.217");
        factory.setUsername("reeygu");
        factory.setPassword("881911");
        Connection connection = factory.newConnection();
        return connection.createChannel();
    }
}
